<import file="js.jquery#chained"/>
<import file="js.maskedinput"/>
<ol class="breadcrumb" >
    <li><i class="fa fa-anchor"></i>
        &nbsp;电桩管理
    </li>
    <li>修改电桩信息</li>
</ol>
<div class="panel panel-mcit">
    <div class="panel-heading">
        <h5 class="panel-title">修改电桩信息</h5>
    </div>
    <div class="panel-body" id="container">
        <div class="col-xs-12 info-center" style=" margin-top: 0px;">
            <form class="form-horizontal" method="post" action="__URL__/update" enctype="multipart/form-data"
                  id="form_check" style="margin-top: 10px;">

                <div class="unit_info" id="unit_info" style="margin-right: 5%;">
                    <div class="clearfix"></div>
                    <div class="col-xs-12">
                        <div class="panel-group" id="accordion">
                        <div class="col-xs-6">
                            <div class="form-group">
                                <label class="col-sm-3 control-label">
                                    <i class="fa fa-asterisk required-fa"></i>&nbsp;所在站点
                                </label>
                                <div class="col-sm-9 control-whole"  style="display:none;">
                                    <input type="hidden" name="id" value="{$charOne.id}"/>
                                    <input type="hidden" id="ev_plant_id" name="ev_plant_id" value="{$charOne.ev_plant_id}"/>
                                    <a class="btn btn-primary" data-toggle="modal" data-target="#companySearchForm"
                                       style="float:left;width: 23.7%;">点击搜索</a>
                                    <input class="form-control"  value="{$charOne.name}" id="siteText" class="alert alert-success required form-control readonlyinput"
                                           style="width: 76.3%;float: left; cursor: default;" readonly="true">
                                </div>
                                <div class="col-sm-9 control-whole" >
                                    <div class="input-group">
                                                        <span class="input-group-btn">
                                                            <a class="btn btn-default" id="location_change">
                                                                修改
                                                            </a>
                                                        </span>
                                        <input type="text" class="form-control"  value="{$charOne.name}" disabled>
                                        <input type="hidden" class="form-control"  name="id"  value="{$charOne.id}">
                                    </div>
                                </div>
                            </div>
                        </div>
                            <div class="col-xs-6">
                                <div class="form-group">
                                    <label class="col-sm-4 control-label"><i class="fa fa-asterisk required-fa"></i>&nbsp;目前已有桩数</label>

                                    <div class="col-sm-8">
                                            <input type="text" class="form-control   job_name" id="total_ev" value="{$charOne.total_ev}"  readonly>
                                        </if>
                                        <span class="help-block error-block"></span>
                                    </div>
                                </div>
                            </div><div class="clearfix"></div>
                            <div class="panel panel-mcit" >
                                <div class="panel-heading"data-toggle="collapse" data-parent="#accordion"
                                     href="#collapse1" style="cursor: pointer;" >
                                    <h4 class="panel-title" >
                                        电桩参数
                                        <a data-toggle="collapse" data-toggle="collapse" data-parent="#accordion"
                                           href="#collapse1"  id="">
                                        </a>
                                    </h4>
                                </div>
                                <div id="collapse1" class="panel-collapse collapse in">
                                    <div class="panel-body">

                                        <div class="col-xs-6">
                                            <div class="form-group">
                                                <label class="col-sm-4 control-label"><i class="fa fa-asterisk required-fa"></i>&nbsp;所在地电桩编号</label>
                                                <div class="col-sm-8">
                                                    <input type="text" class="form-control required" value="{$charOne.charID}" name="charID">
                                                </div>
                                            </div>
                                        </div>
                                        <div class="col-xs-6">
                                            <div class="form-group">
                                                <label class="col-sm-4 control-label"><i class="fa fa-asterisk required-fa"></i>&nbsp;运营二维码</label>
                                                <div class="col-sm-8">
                                                    <input type="text" class="form-control required" value="{$charOne.evc_number}" name="evc_number">
                                                </div>
                                            </div>
                                        </div><div class="clearfix"></div>
                                        <div class="col-xs-6">
                                            <div class="form-group">
                                                <label class="col-sm-4 control-label"><i class="fa fa-asterisk required-fa"></i>&nbsp;设备地址</label>
                                                <div class="col-sm-8">
                                                    <input type="text" class="form-control" value="{$charOne.key_link}" readonly>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="col-xs-6">
                                            <div class="form-group">
                                                <label class="col-sm-4 control-label"><i class="fa fa-asterisk required-fa"></i>&nbsp;SLINK（状态ip）</label>

                                                <div class="col-sm-8">
                                                    <input type="text" class="form-control  job_name"  value="{$charOne.s_link}" readonly>
                                                </div>
                                            </div>
                                        </div><div class="clearfix"></div>
                                        <div class="col-xs-6">
                                            <div class="form-group">
                                                <label class="col-sm-4 control-label"><i class="fa fa-asterisk required-fa"></i>&nbsp;HLINK（硬件ip）</label>
                                                <div class="col-sm-5">
                                                    <input type="text" class="form-control " value="{$charOne.h_link}"  readonly>
                                                    <span class="help-block error-block"></span>
                                                </div><span class="pull-left">端<br>口</span>
                                                <div class="col-sm-2">
                                                    <input type="text" style="width: 82px" class="form-control " value="{$charOne.h_link_port}"  readonly>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="col-xs-6">
                                            <div class="form-group">
                                                <label class="col-sm-4 control-label">&nbsp;WIFI编号</label>
                                                <div class="col-sm-8">
                                                    <div class="input-group">
                                                        <if condition="$charOne.wifi eq 1">
                                                            <input type="hidden" name="wifi" value="1"  checked>
                                                            <input type="text" class="form-control " value="{$charOne.card_wifi}"  name="card_wifi"
                                                                   id="person_num" style="border-color:#cccccc;">
                                                            <span class="input-group-addon" style="padding:0px 12px;">
                                                                <div class="checkbox" id="nolimit">
                                                                    <label>
                                                                        <input type="checkbox" name="wifi" value="0" id="checkbox"> 不支持
                                                                    </label>
                                                                </div>
                                                            </span>
                                                            <else />
                                                            <input type="hidden" name="wifi" value="1"  checked>
                                                            <input type="text" class="form-control" value=""  name="card_wifi"
                                                                   id="person_num" style="border-color:#cccccc;" disabled>
                                                            <span class="input-group-addon" style="padding:0px 12px;">
                                                                <div class="checkbox" id="nolimit">
                                                                    <label>
                                                                        <input type="checkbox" name="wifi" value="0" id="checkbox" checked> 不支持
                                                                    </label>
                                                                </div>
                                                            </span>
                                                        </if>
                                                    </div>
                                                </div>
                                            </div>
                                        </div><div class="clearfix"></div>
                                        <div class="col-xs-6">
                                            <div class="form-group">
                                                <label class="col-sm-4 control-label"><i class="fa fa-asterisk required-fa"></i>&nbsp;GPRS卡号</label>
                                                <div class="col-sm-8">
                                                    <input type="text" class="form-control required" value="{$charOne.card_gprg}" name="card_gprg">
                                                </div>
                                            </div>
                                        </div>
                                        <div class="col-xs-6">
                                            <div class="form-group">
                                                <label class="col-sm-4 control-label"><i class="fa fa-asterisk required-fa"></i>&nbsp;电流类型</label>
                                                <div class="col-sm-8" >
                                                    <select   class="form-control " readonly>
                                                        <if condition="$charOne.evc_type eq 1">
                                                            <option value="1">直流</option>
                                                        <elseif condition="$charOne.evc_type eq 2" />
                                                            <option value="2">交流</option>
                                                        <else />
                                                            <option value="3">混合</option>
                                                        </if>
                                                    </select>
                                                </div>
                                            </div>
                                        </div><div class="clearfix"></div>
                                        <div class="col-xs-6">
                                            <div class="form-group">
                                                <label class="col-sm-4 control-label"><i class="fa fa-asterisk required-fa"></i>&nbsp;电桩属性</label>
                                                <div class="col-sm-8" >
                                                    <select   class="form-control " readonly>
                                                        <if condition="$charOne.evc_quantity eq 1">
                                                            <option value="1">单枪</option>
                                                        <else />
                                                            <option value="2">双枪</option>
                                                        </if>
                                                    </select>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="col-xs-6">
                                            <div class="form-group">
                                                <label class="col-sm-4 control-label"><i class="fa fa-asterisk required-fa"></i>&nbsp;SN</label>
                                                <div class="col-sm-8">
                                                    <input type="text" class="form-control"  value="{$charOne.evc_sn}" readonly>
                                                </div>
                                            </div>
                                        </div><div class="clearfix"></div>
                                        <div class="col-xs-6">
                                            <div class="form-group">
                                                <label class="col-sm-4 control-label">
                                                    <i class="fa fa-asterisk required-fa"></i>&nbsp;生产厂商及设备类型
                                                </label>
                                                <div class="col-sm-8" >
                                                    <input type="text" class="form-control"  value="{$charOne.ev_fac_codeText}" readonly>
                                                </div>
                                                </div>
                                            </div>
                                        </div><div class="clearfix"></div>
                                        <div class="col-xs-6">
                                            <div class="form-group">
                                                <div class="col-sm-offset-4 col-sm-8">
                                                    <a data-toggle="collapse" data-parent="#accordion" href="#collapse1" class="btn btn-primary hide_this_panel">
                                                        <i class="glyphicon glyphicon-chevron-up"></i>&nbsp;收起</a>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div id="creat_flag"></div>
                </div>

                <div class="col-xs-6">
                    <div class="form-group">
                        <label class="col-sm-3 control-label"><i class="fa fa-asterisk required-fa"></i>&nbsp;安装时间</label>

                        <div class="col-sm-9">
                            <input type="text" class="form-control  form_month" value="{$charOne.sys_creat_time}"  readonly>
                        </div>
                    </div>
                </div>
                <div class="col-xs-6">
                    <div class="form-group">
                        <div class="col-sm-offset-4 col-sm-8">
                            <button type="submit" class="btn btn-primary dianji"><i class="fa fa-upload"></i>&nbsp;确定</button>
                            <a href="javascript:history.go(-1);" class="btn btn-warning"><i class="fa fa-mail-reply"></i>&nbsp;返回</a>
                        </div>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
<!-- 搜索站点 -->

<div class="modal fade" id="companySearchForm" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
     aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="myModalLabel">搜索站点</h4>
            </div>
            <div class="modal-body">
                <div style="margin-top: 10px; width: 1200px;">
                    <div class="col-xs-6 search-col">
                        <div class="input-group">
                            <span class="input-group-addon" >所在地</span>
                            <select id="location-f" name="location_f_1" class="form-control" style="width:130px;">
                                <option value="0">--</option>
                                <volist name="china" id="vo">
                                    <option value="{$vo.code}">{$vo.name}</option>
                                </volist>
                            </select>

                            <select id="location-s" name="location_s_1" class="form-control" style="width:130px;border-left:0">
                                <option value="0">--</option>
                                <volist name="china" id="vo">
                                    <volist name="vo['area']" id="vovo">
                                        <option value="{$vovo.code}" class="{$vo.code}" >{$vovo.name}</option>
                                    </volist>
                                </volist>
                            </select>

                            <select id="location-t" name="location_t_1" class="form-control " style="width:130px;border-left:0">
                                <option value="0">--</option>
                                <volist name="china" id="vo">
                                    <volist name="vo['area']" id="vovo">
                                        <volist name="vovo['area']" id="vovovo">
                                            <option value="{$vovovo.code}" class="{$vovo.code}" >{$vovovo.name}</option>
                                        </volist>
                                    </volist>
                                </volist>
                            </select>
                            <button style="margin-left: 10px;" type="submit" class="btn btn-primary" id="companySearchBtn"><i class="fa fa-search"></i>&nbsp;搜索
                            </button>
                        </div>
                    </div>
                </div>
                搜索结果（点击名称进行选择）：
                <div class="alert alert-success" id="searchResult">
                </div>
            </div>
        </div>
    </div>
</div>
<import file="js.jquery#chained" />
<import file="js.ueditor_light.ueditor#config"/>
<import file="js.ueditor_light.ueditor#all"/>
<import file="js.ueditor_light.lang.zh-cn.zh-cn"/>
<import type='css' file="css.datetimepicker"/>
<import file="js.bootstrap-datetimepicker#min"/>
<import file="js.bootstrap-datetimepicker#zh-CN"/>
<!--<import file="js.markdown.markdown#min"/>-->
<!--<script type="text/javascript" src="../../Markdown.Converter.js"></script>
<script type="text/javascript" src="../../Markdown.Sanitizer.js"></script>
<script type="text/javascript" src="../../Markdown.Editor.js"></script>-->
<style>
    .readonlyinput {
        cursor: default;
    }

    .pointcheckbox {
        cursor: pointer;
    }

    .schoolnoselect {
        color: #2b669a;
    }
</style>
<script>
    $(document).ready(function(){
        $("#location-s").chained("#location-f");
        $("#location-t").chained("#location-s");

        //搜索站点
        $("#companySearchBtn").click(function () {
            $.post("__URL__/AjaxPlantSearch",
                    {
                        location_f_1: $("#location-f").val(),
                        location_s_1: $("#location-s").val(),
                        location_t_1: $("#location-t").val()
                    },
                    function (data, status) {
                        //alert(data);
                        if (status == "success") {
                            $("#searchResult").html(data);
                        }
                    }
            );
        });
        //传站点数据
        $(".modal-body").on("click", '.siteSelect', function () {
            var plantID  = $(this).attr("data-nid");//站点id
            $("#ev_plant_id").val(plantID);
            var siteName = $(this).text();//站点名称
            $("#siteText").val(siteName);
            var total_ev = $(this).attr("data-pid");//目前已有桩数
            $("#total_ev").val(total_ev);
        });

        $("#location_change").on("click",function(){
            $(this).parents('.col-sm-9').hide();
            $(this).parents('.col-sm-9').prev().show();
            addRequired($("#location-t"));
            $("#location").attr('disabled',true);
        });


        $("input[name='evc_type']").click(function(){
            var evc_type  =  $("input[name='evc_type']:checked").val();
            if(evc_type == 2){
                $("#show_quantity").show();
            }else{

                $("#show_quantity").hide();
            }
        });
    })
</script>
<script>
var panel_num=1;
$(document).ready(function () {

    $("body").on("click",".marjorBtn",function(){
        click_temp=$(this).attr("id");
    });

    $(".hide_this_panel").click(function (){

    });

    $("body").on("click",'.add_new_panel',function(){
        panel_num++;
        $('#recruit_num').val(panel_num);
        $("#creat_flag").append(
                get_panel_html(panel_num)
        );
    });

    $("body").on("click",'.del_this_panel',function(){
        if(confirm("确定要删除当前岗位吗？"))
            if(panel_num==1)
            {
                alert("当前只有一条岗位信息，不能删除！");
            }
            else {
                panel_num--;
                $('#recruit_num').val(panel_num);
                $(this).parent().parent().parent().parent().parent().remove();
            }
    });

    $("#nolimit").click(function () {
        var checkbox = document.getElementById("checkbox");
        var temp;
        if (checkbox.checked) {
            //             temp=$("#person_num").val();
            $("#person_num").val(" ");
            $("#person_num").enable(false);
        }
        else {
            $("#person_num").enable(true);
            //          $("#person_num").val(temp);
        }

    });

    $(".pointcheckbox").click(function () {
        if (this.previousElementSibling.checked)
            this.previousElementSibling.checked = false;
        else this.previousElementSibling.checked = true;
    });

    $(".form_month").datetimepicker({
        language: 'zh-CN',
        autoclose: true,
        startView: 'month',
        minView: 'day',
        todayBtn: false,
        viewSelect: 'year',
        pickerPosition: "bottom-left"
    });

    jQuery.extend(jQuery.validator.messages, {
        required: "必选字段",
        number: "必须为数字",
    });

    $("#form_check").validate(
            {
                //debug: true,
                //调试模式取消submit的默认提交功能
                onkeyup: false,
                errorClass: "mcit-error",
                validClass: "mcit-valid",
                email:true,
                // submitHandler: function(form){
                //     //alert("提交服务器");
                //     form.submit();提交表单
                // },
                rules: {
                    num: {
                        minlength: 9,
                    }
                },
                messages: {
                    num: {
                        minlength: "格式不对",
                    }
                },
                errorPlacement: function (error, element) {
                    error.appendTo(element.next());
                },
                highlight: function (element, errorClass) {
                    //$(element).addClass(errorClass);
                    $(element).parent().addClass(errorClass);
                    $(element).next().css("display", "block");
                    $(element).next().next().hide();
                },
                success: function (label) {
                    label.parent().next().hide();
                    label.addClass('mcit-valid');
                    label.parent().parent().addClass('mcit-valid');
                    label.parent().css("display", "block");
                    label.html('<i class="fa fa-check"></i>&nbsp;OK');
                }
            }
    );

});
</script>